package com.robot.agent.client;

import com.robot.agent.client.impl.OrdersClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * orders模块跨域调用
 *
 * @author lin
 */
@Component
@FeignClient(value = "robot-orders", fallback = OrdersClientImpl.class)
public interface OrdersClient {
    /**
     * 根据agentId查找今天订单
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByAgentIdAndToday/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByAgentIdAndToday(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据agentId查找昨天订单
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByAgentIdAndYesterday/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByAgentIdAndYesterday(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据agentId查找最近7日订单
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByAgentIdAndWeek/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByAgentIdAndWeek(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据agentId查找总订单
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersByAgentIdAndTotal/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersByAgentIdAndTotal(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据agentId查找昨天订单数和收益
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersCountByAgentIdAndYesterday/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersCountByAgentIdAndYesterday(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据agentId查找最近7日订单数和收益
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersCountByAgentIdAndWeek/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersCountByAgentIdAndWeek(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据agentId查找总订单数和收益
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "subOrders/third/findSubOrdersCountByAgentIdAndTotal/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindSubOrdersCountByAgentIdAndTotal(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);


    /**
     * 根据agentId查询采购付款凭证列表
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "confirmation/third/findConfirmationsByAgentIdOrderByCreatedAt/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindConfirmationsByAgentIdOrderByCreatedAt(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据agentId和status查询采购付款凭证列表
     *
     * @param agentId
     * @param status
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "confirmation/third/findConfirmationsByAgentIdAndStatusOrderByCreatedAt/{agentId}/{status}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindConfirmationsByAgentIdAndStatusOrderByCreatedAt(@PathVariable String agentId, @PathVariable String status, @PathVariable int page, @PathVariable int size);

    /**
     * 根据ID查询
     *
     * @param id ID
     * @return
     */
    @RequestMapping(value = "confirmation/third/findConfirmationById/{id}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindConfirmationById(@PathVariable String id);

    /**
     * 增加采购付款凭证
     *
     * @param confirmation
     * @return
     */
    @RequestMapping(value = "confirmation/third/addConfirmation", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdAddConfirmation(@RequestBody String confirmation);

    /**
     * 修改
     *
     * @param confirmation
     */
    @RequestMapping(value = "confirmation/third/updateConfirmation", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    public void thirdUpdateConfirmation(@RequestBody String confirmation);


    /**
     * 通过agentId查询purchase列表并分页
     *
     * @param agentId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "purchase/third/findPurchasesByAgentIdAndDeletedAtIsNullOrderByCreatedAtDesc/{agentId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindPurchasesByAgentIdAndDeletedAtIsNullOrderByCreatedAtDesc(@PathVariable String agentId, @PathVariable int page, @PathVariable int size);

    /**
     * 通过agentId和status查询purchase列表并分页
     *
     * @param agentId
     * @param status
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "purchase/third/findPurchasesByAgentIdAndStatusAndDeletedAtIsNullOrderByCreatedAtDesc/{agentId}/{status}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindPurchasesByAgentIdAndStatusAndDeletedAtIsNullOrderByCreatedAtDesc(@PathVariable String agentId, @PathVariable String status, @PathVariable int page, @PathVariable int size);

    /**
     * 通过agentId和id查询purchase列表并分页
     *
     * @param id
     * @param agentId
     * @return
     */
    @RequestMapping(value = "purchase/third/findPurchaseByIdAndAgentId/{id}/{agentId}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindPurchaseByIdAndAgentId(@PathVariable String id, @PathVariable String agentId);
}
